/**
 * 权限声明：
 */
package com.handy.plugin.auth.bean;

import java.util.Date;
import java.util.List;

public class HAuthUser implements java.io.Serializable {

	private static final long serialVersionUID = 1305000505993078652L;
	private Integer id;
	private String username = "";//用户名(账号)
	private String password = "";//密码
	private String realname = "";//真实姓名
	private Integer gender = 0;//性别 0.男,1.女
	private String phone = "";
	private String email = "";
	private Date createtime;//创建时间
	private Date endtime;//试用结束时间
	private String cendtime;//试用结束时间
	private Integer state = 0;/* 状态0.正常,1.试用 2.注销 */
	private Integer rolekind =3 ;//角色类型 : 默认为非admin,dev用户
	private String roleids ;	//用户所属角色,多个角色用逗号分开
	private List<HAuthRole> roles;

	public HAuthUser() {
	}
	
	public Date getEndtime() {
		return endtime;
	}

	public void setEndtime(Date endtime) {
		this.endtime = endtime;
	}

//	public HAuthRole getHAuthRole() {
//		return hAuthRole;
//	}
//
//	public void setHAuthRole(HAuthRole authRole) {
//		hAuthRole = authRole;
//	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

//	public HAuthRole getRole() {
//		return hAuthRole;
//	}
//
//	public void setRole(HAuthRole hAuthRole) {
//		this.hAuthRole = hAuthRole;
//	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRealname() {
		return this.realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

 

	public Integer getGender() {
		return this.gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public String getCendtime() {
		return cendtime;
	}

	public void setCendtime(String cendtime) {
		this.cendtime = cendtime;
	}

	public List<HAuthRole> getRoles() {
		return roles;
	}

	public void setRoles(List<HAuthRole> authRoles) {
		roles = authRoles;
	}

	public Integer getRolekind() {
		return rolekind;
	}

	public void setRolekind(Integer rolekind) {
		this.rolekind = rolekind;
	}

	public String getRoleids() {
		return roleids;
	}

	//将以逗号分隔的roleids(1,3,5)转为以下格式: filed=1 or filed=3 or filed=5
	//filed 数据库对应的字段
	//keyword and 或 or
	//主要用于字符串的查询,组装成sql语句
	public String getRoleids(String filed, String keyword) {
//		System.out.println("in HAuthUser.java = " + roleids);
		if(null==roleids || "".equalsIgnoreCase(roleids)) return null;
		String ret = "";
		String[] arr = roleids.split(",");
		for(int i=0; i<arr.length ; i++){
			ret += filed + "=" + arr[i];
			if(i<arr.length-1 ) ret += keyword;
		}
		return ret;
	}
	
	public void setRoleids(String roleids) {
		this.roleids = roleids;
	}

 

}